Orientation detection device, orientation detection method and program storage medium

ABSTRACT

In the preset invention, in an initial stationary state of a drumstick section, a CPU stores each axis component of geomagnetism obtained by a magnetic sensor in a RAM, and obtains each axis component of geomagnetism obtained by the magnetic sensor which is changed by a motion provided to the drumstick section at every predetermined timing. Then, the CPU accumulates each axis component of geomagnetism obtained at every predetermined timing, for each predetermined interval, and conforms each axis component of geomagnetism accumulated thereby to each axis component of geomagnetism stored in the RAM.

CROSS-REFERENCE TO RELATED APPLICATION

This application is based upon and claims the benefit of priority fromthe prior Japanese Patent Application No. 2012-084369, filed Apr. 2,2012, the entire contents of which is incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an orientation detection device, anorientation detection method and a program storage medium.

2. Description of the Related Art

Conventionally, a musical performance device has been proposed whichdetects the playing motion of an instrument player and emits a soundcorresponding to the playing motion. For example, a musical performancedevice is known which emits a percussion sound with a structure onlyincluding a drumstick-shaped member. In this musical performance device,a sensor is provided to its drumstick-shaped member. When the instrumentplayer holds and swings the member by hand, the sensor detects theplaying motion, and a percussion sound is emitted.

With this virtual musical performance device, a musical sound of amusical instrument can be emitted without requiring a real musicalinstrument, and therefore the instrument player can enjoy playingwithout restrictions on a playing place or a playing space.

As a virtual musical performance device as described above, for example,Japanese Patent Application Laid-Open (Kokai) Publication No.2007-256736 discloses a musical performance device which is structuredsuch that an acceleration sensor is provided to a drumstick-shapedmember, and emits a musical sound after an output (an accelerationvalue) obtained from the acceleration sensor by shaking the memberreaches a predetermined threshold.

Meanwhile, in the virtual musical performance device, a differentmusical sound is often provided for each different playing motion of aninstrument player. Also in the configuration of the musical performancedevice disclosed in Japanese Patent Application Laid-Open (Kokai)Publication No. 2007-256736, a geomagnetic sensor is used to determinethe orientation of the drumstick-shaped member and a musical sound of adifferent timbre can be emitted according to the orientation. In thiscase, however, since a sound source can be placed only in a horizontaldirection, the maximum number of sound sources is three or four, andsound sources more than this cannot be placed. Moreover, since thegeomagnetic sensor is vulnerable to disturbances and unstable, if thegeomagnetic sensor is moved at high speed as the drumstick, accuracy ofazimuth estimation is degraded.

SUMMARY OF THE INVENTION

The present invention has been conceived in light of the above-describedproblems. An object of the present invention is to provide anorientation detection device which corrects a gravity direction when adrumstick-shaped member is moved at high speed, and thereby improvesaccuracy in estimating the orientation of a drumstick-shaped member.

In accordance with one aspect of the present invention, there isprovided an orientation detection device comprising: a holding memberwhich is operated by a user; a magnetic sensor which detects magnetismoccurring in each direction of three axes of the holding member whichare orthogonal to each other; a storage control section which stores inmemory the magnetism by geomagnetism detected by the magnetic sensor inan initial stationary state of the holding member and an orientationparameter in the initial stationary state; an obtainment section whichobtains the magnetism detected by the magnetic sensor at everypredetermined timing; an accumulation section which accumulates outputvalues of each axis component of the magnetic sensor obtained at everypredetermined timing by the obtainment section; and a correction sectionwhich corrects the orientation parameter so that the output value ofeach axis component of the magnetic sensor accumulated by theaccumulation section conforms to initial magnetism stored in the memory.

The above and further objects and novel features of the presentinvention will more fully appear from the following detailed descriptionwhen the same is read in conjunction with the accompanying drawings. Itis to be expressly understood, however, that the drawings are for thepurpose of illustration only and are not intended as a definition of thelimits of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram outlining an embodiment of a musical performancedevice of the present invention;

FIG. 2 is a block diagram showing the structure of a drumstick sectionof the musical performance device;

FIG. 3 is a block diagram showing the structure of a sound emittingsection of the musical performance device;

FIG. 4 is a diagram for describing the drumstick section of the musicalperformance device in detail;

FIG. 5 is a diagram for describing a world coordinate system accordingto an embodiment of the musical performance device of the presentinvention;

FIG. 6 is a flowchart of processing to be performed by a CPU of thedrumstick section;

FIG. 7 is a flowchart of processing for initializing an orientationsensor and an orientation;

FIG. 8 is a flowchart of orientation estimation processing;

FIG. 9 is a flowchart of position estimation processing;

FIG. 10 is a flowchart of tip motion prediction processing;

FIG. 11 is a diagram of a relation between a drumstick tip rotation axisand a swing direction of the drumstick section;

FIG. 12 is a flowchart of sound emission timing detection processing ina first example;

FIG. 13 is a flowchart of sound emission timing detection processing ina second example;

FIG. 14A to FIG. 14D are diagrams showing the transitions of a motionstate of the drumstick section;

FIG. 15 is a flowchart of sound emission amount detection processing;

FIG. 16 is a flowchart of note event generation processing;

FIG. 17 is a flowchart of sound search processing in a modificationexample; and

FIG. 18 is a flowchart of sound emission processing.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Hereafter, embodiments of the present invention are described using thedrawings.

An embodiment of the present invention is described below with referenceto the attached drawings.

FIG. 1 is a diagram outlining a musical performance device 1 of anembodiment of the present invention. As depicted in FIG. 1, the musicalperformance device 1 of the present invention includes a drumsticksection 10 and a sound emitting section 30.

The drumstick section 10 is a drumstick-shaped member extending in alongitudinal direction. An instrument player performs a playing motionby holding one end (a bottom side) of the drumstick section 10 andperforming upswing and downswing motions centering on his or her wristor the like. To detect this playing motion of the instrument player, anorientation, sensor 12 is provided at the other end (a tip side) of thedrumstick section 10 (refer to FIG. 2).

The sound emitting section 30 emits a musical sound.

In the musical performance device 1, according to a playing motion usingthe drumstick section 10, that is, the downswing motion of the drumsticksection 10, the sound emitting section 30 emits a predetermined musicalsound. With this, music is played by the instrument player.

[Structure of Musical Performance Device 1]

First, with reference to FIG. 2 and FIG. 3, the structures of componentsof the musical performance device 1 of the present embodiment,specifically, the structures of the drumstick section 10 and the soundemitting section 30, are described.

[Structure of Drumstick Section 10]

FIG. 2 is a block diagram showing the structure of the drumstick section10. As depicted in FIG. 2, the drumstick section 10 includes a CPU(Central Processing Unit) 11, the orientation sensor 12, an I/F(Interface) device 13, a ROM (Read Only Memory) 14, a RAM (Random AccessMemory) 15, an input section 16, a wireless communication device 17, andan LED 18.

The orientation sensor 12 includes a triaxial magnetic sensor 121 whichmeasures a geomagnetic direction, a triaxial acceleration sensor 122 formeasuring acceleration added to the drumstick, and a triaxial angularvelocity sensor 123 which measures a rotating motion of the drumstick.Each sensor can measure three axes x, y, and z each in an axialdirection.

With reference to FIG. 4, in the present embodiment, an axis conformingto an axis of the drumstick section 10 in a longitudinal direction istaken as y axis, an axis parallel with a substrate (not shown) where theorientation sensor 12 is placed and orthogonal to the y axis is taken asx axis, and an axis orthogonal to the x axis and the y axis is taken asz axis. The magnetic sensor 121 can obtain geomagnetic values ofrespective components of the x axis, the y axis, and the z axis of ageomagnetic vector. Also, the acceleration sensor 122 can obtainacceleration values of respective components of the x axis, the y axis,and the z axis. Furthermore, the angular velocity sensor 123 can obtaina value (ωx, ωy, ωz) of respective components of angular velocities eachcentering on a relevant one of the axes.

Here, the instrument player holds the one end (on the bottom side) ofthe drumstick section 10, performs upswing and downswing motionscentering on his or her wrist or the like, and thereby causes thedrumstick section 10 to perform a rotating motion, a parallel motion, orthe like. These motions are detected by the orientation sensor 12 andsent to the CPU 11.

Referring back to FIG. 2, the CPU 11 reads acceleration values, angularvelocity values, geomagnetic directions and intensities detected by theorientation sensor 12 and, according to these values, detects theorientation of the drumstick and timing of sound emission. With this,the CPU 11 generates a note-on event corresponding to the soundemission, and transmits the note-on event to the sound emitting section30 via the I/F device 13 and the wireless communication device 17. Here,the note-on event is command information for indicating to a soundsource section 371 (refer to FIG. 3) the emission of a musical sound,and includes, in the present embodiment, information about timbre andpitch of a musical sound to be emitted and a sound volume of the musicalsound.

As such, the CPU 11 transmits a note-on event to the sound emittingsection 30 based on each sensor value of the orientation sensor 12included in the drumstick section 10, and thereby allows the soundemitting section 30 to emit a predetermined musical sound based on theplaying motion using the drumstick section 10.

The ROM 14 has stored therein processing programs for a variety ofprocessing to be performed by the CPU 11, that is, as described above,data obtainment by the orientation sensor 12, note-on event generationprocessing, note-on event transmission processing and the like. The RAM15 has stored therein each sensor value of the orientation sensor 12 andvalues obtained or generated in processing. The I/F device 13 outputsdata to the wireless communication device 17 according to an instructionfrom the CPU 11.

The input section 16 has various switches (not shown), accepting variousinstruction inputs from the instrument player.

The wireless communication device 17 performs a predetermined wirelesscommunication with the sound emitting section 30. The predeterminedwireless communication may be performed with any method. In the presentembodiment, the wireless communication device 17 performs a wirelesscommunication with the sound emitting section 30 via an infraredcommunication. The LED 18 lights up and out according to the controlfrom the CPU 11. The LED 18 is used to indicate a processing state ofthe drumstick, such as initialization of the drumstick orientation.

[Structure of Sound Emitting Section 30]

Next, the structure of the sound emitting section 30 is described withreference to FIG. 3. FIG. 3 is a block diagram of the structure of thesound emitting section 30. As depicted in FIG. 3, the sound emittingsection 30 includes a CPU 31, an I/F (Interface) 32, a ROM 33, a RAM 34,a display section 35, an input section 36, and a sound system 37. TheI/F 32 of the sound emitting section 30 accepts data (for example, anote-on event, which is control data for emitting a musical sound),stores the data in the RAM 34, and notifies the CPU 31 of dataacceptance. In the present embodiment, the wireless communication device17 is provided to the drumstick section 10, and an infraredcommunication device 38 is provided to the sound emitting section 30. Bya wireless signal issued from the wireless communication device 17 ofthe drumstick section 10 being received by the infrared communicationdevice 38, the I/F 32 receives data from the drumstick section 10.

The CPU 31 performs a variety of processing, such as control over theentire musical performance device 1, in particular, control over thesound emitting section 30, detection of operation of a key switch (notshown) constituting the input section 36, and musical sound emissionbased on a note-on event from the drumstick section 10 received via theI/F 32.

The ROM 33 has stored therein various programs for processing, such ascontrol over the entire musical performance device 1, in particular,control over the sound emitting section 30, detection of operation ofthe key switch (not shown) configuring the input section 36, and musicalsound emission based on a note-on event received via the I/F 32. The ROM33 includes a waveform data area for storing waveform data of varioustimbres, for example, those of wind instruments such as flutes,saxophones, and trumpets; keyboard instruments such as pianos; stringedinstruments such as guitars; and percussion instruments such as bassdrums, high-hats, snare drums, cymbals, and tamtams.

The RAM 34 stores a program read from the ROM 33 and data and parametersoccurring in the course of processing. The data occurring in the courseof processing includes those of an operation state of each switch of theinput section 36, a note-on even received via the I/F 32, and the statusof a body motion of the instrument player (such as an advance flag or adisplacement amount).

The display section 35 is constituted by, for example, a liquid-crystaldisplay device, and displays a selected timbre, a selected sound volume,the state of the body motion of the instrument player (a displacementamount from a reference position), and the like as images. The inputsection 36 has various switches (not shown), and accepts inputs of avariety of information from the instrument player.

The sound system 37 includes the sound source section 371, an audiocircuit 372, and a loudspeaker 373. The sound source section 371 readswaveform data from the waveform data area of the ROM 33 by following aninstruction from the CPU 31 to generate musical sound data for output.The audio circuit 372 converts musical sound data outputted from thesound source section 371 to an analog signal, and amplifies and outputsthe analog signal obtained by conversion to the loudspeaker 373. Withthis, a musical sound is outputted from the loudspeaker 373.

[Description of Coordinate System]

Next, the orientation of the drumstick and a world coordinate system inthe present embodiment are described with reference to FIG. 5. Here, theworld coordinates refer to a coordinate system centering on aninstrument player. As in FIG. 5, when viewed from the instrument player,a right horizontal direction is defined as X axis, a forward horizontaldirection is defined as Y axis, and a zenithal direction is defined as Zaxis. These axes are different from the x axis, the y axis, and the zaxis depicted in FIG. 4, which are three axes of the drumstick section10. In the present embodiment, while the three axes of the drumsticksection 10 are called a local coordinate system and represented bylower-case letters, the three axes in the world coordinate system arerepresented by upper-case letters. As the instrument player swings thedrumstick section 10, a relation between the local coordinates and theworld coordinates is changed with time. The orientation of the drumstickrefers to how the local coordinate system of the drumstick section 10 isoriented when viewed from the world coordinate system.

When the drumstick section 10 moves, the origin of the local coordinatesystem when viewed from the origin of the world coordinate system alsomoves. The origin of the local coordinate system when viewed from theworld coordinate system is referred to as a position of the drumsticksection 10.

[Processing of Musical Performance Device 1]

Next, processing of the musical performance device 1 of the presentembodiment is described. First, the processing to be performed in thedrumstick section 10 is briefly described with reference to FIG. 6.

FIG. 6 is a flowchart of the processing to be performed by the CPU 11 ofthe drumstick section 10. The CPU 11 reads program code from the ROM 14for execution.

First, the CPU 11 performs initialization processing includinginitialization of various sensors included in the orientation sensor 12and clearing of data in the RAM 15 (Step S11). When the initializationprocessing ends, the CPU 11 adjusts offset, gain, and the like whichchange due to device variations and temperature of various sensorsincluded in the orientation sensor 12 (Step S12). Next, the CPU 11 readsthe status of the switches of the input section 36 and stores the statusin the RAM 15 (Step S14). The status of the switches stored in the RAM15 is used, for example, for assisting position detection, which will bedescribed further below.

Next, when the user swings the drumstick section 10, the CPU 11 performsprocessing for emitting a sound according to the swing (Steps S16 toS24). First, the CPU 11 stores an acceleration value and an angularvelocity value of the orientation sensor 12 and direction and intensityof geomagnetism in the RAM 15 (Step S16).

According to the read values, the CPU 11 estimates the orientation ofthe drumstick section 10 (Step S17), and then estimates the position intranslation of the drumstick section 10 (Step S18). Furthermore, the CPU11 predicts the motion of the tip of the drumstick section 10 (StepS19), and detects sound emission timing by using the predicted motion(Step S20). Still further, the CPU 11 detects a sound emission amount(Step S21). When sound emission timing is detected (when the motionstate is “SHOT”, which will be described further below) at Step S20(when a judgment result at Step S22 is YES), the CPU 11 determines atimbre and pitch of a musical sound according to the orientation andposition of the drumstick section 10 and generates a note-on event (StepS23), and transmits the generated note-on event to the sound emittingsection 30 (Step S24).

[Initialization of Orientation Sensor and Orientation]

With reference to FIG. 7, processing for initializing the orientationsensor and the orientation at Step S12 of FIG. 16 is described indetail.

FIG. 7 is a flowchart of the processing for initializing the orientationsensor and the orientation.

First, the CPU 11 performs display so as to ask the user to staystationary with the tip of the drumstick section 10 oriented in aforward direction (Step S71). In a display example, the CPU 11 causesthe LED 18 to light up in green.

Next, the CPU 11 reads data of each axis of the angular velocity sensor123. In the angular velocity sensor 123, due to device variations andtemperature fluctuations, an offset value normally fluctuates when theangular velocity is 0. The CPU 11 stores the value of the angularvelocity sensor 123 in the RAM 15 as an offset value (Step S72). In thefollowing steps, when reading the value of the angular velocity sensor123, the CPU 11 subtracts the offset value from the read value, andthereby adjusts the angular velocity to 0 when the drumstick section 10stays stationary.

Next, the CPU 11 reads data of each axis of the acceleration sensor 122to compare the read data with the previous acceleration, and therebyjudges whether a change in a gravity direction has been detected (StepS74). Specifically, when the drumstick section 10 is in a stationarystate, the value of the acceleration sensor 122 only indicates each axiscomponent in the gravity direction. Therefore, if the value of each axiscomponent has not been changed, the CPU 11 can detect that the drumstickis in a stationary state. In the present embodiment, the CPU 11 detectsthat the drumstick is in a stationary state if there is no change forapproximately one second. When the drumstick is detected to be in astationary state, the CPU 11 completes registration of the offset valueof the angular velocity, and proceeds to Step S75. On the other hand,when the drumstick is detected to have been moved, the CPU 11 proceedsto Step S72, and again registers the offset value.

Subsequently, the CPU 11 initializes the orientation (Step S75).Specifically, the CPU 11 initializes the relation between the worldcoordinate system and the local coordinate system such that, with theuser orienting the tip of the drumstick section 10 in a forwarddirection, the direction in which the tip of the drumstick section 10 isoriented is the front direction of the world coordinate system (in Yaxis direction). The CPU 11 also stores each axis component of angularvelocity, acceleration, and geomagnetism at the time of initializationin the RAM 15.

Subsequently, the CPU 11 performs display for causing the user to orientthe drumstick section 10 in various directions (Step S76). For example,the CPU 11 causes the LED 18 to light up in red.

Furthermore, the CPU 11 finds an offset and gain correction data of themagnetic sensor 121 (Step S77). Specifically, in response to theprocessing at Step S76, the CPU 11 causes the magnetic sensor 121 tomeasure geomagnetic values when the user orients the drumstick section10 in various directions, and thereby finds correction data by using thegeomagnetic values obtained by measurement. As an example of how to findoffset and gain values, the CPU 11 calculates a median value from amaximum value and a minimum value of each axis of the magnetic sensor121, and sets the calculated median value as an offset value of eachaxis.

Also, the CPU 11 calculates a gain correction value so that values fromthe center to the maximum value in the respective axes are equal, andstores the calculated offset value and the gain correction value in theRAM 15. At the following steps, when a value of the magnetic sensor 121is read out, the CPU 11 subtracts the offset value from the read valueand multiplies the resultant value by the correction gain to correct thegeomagnetic value and sets the corrected value as a detection value.

Subsequently, the CPU 11 judges whether the detected geomagnetic valueis a value to be detected on the ground in general (Step S78). When thedetected geomagnetic value is not a value to be detected on the groundin general, the CPU 11 returns to Step S76, and again finds an offsetvalue and a gain correction data of the magnetic sensor 121. When thedetected geomagnetic value is a value to be detected on the ground ingeneral, the CPU 11 proceeds to Step S79, and sets a yaw correction modeto a geomagnetic mode.

Also, when the detected geomagnetic value is not a value to be detectedon the ground in general even if the processing at Step S78 is repeatedat a predetermined number of times (for example, five times), the CPU 11proceeds to Step S80, and sets a yaw correction mode to a shot mode.When the processing at Step S79 or Step S80 ends, the CPU 11 proceeds toStep S81, and performs display indicating whether the yaw correctionmode is a geomagnetic mode or a shot mode. For example, the CPU 11causes the LED 18 to light up in red in the case of the shot mode, andcauses the LED 18 to light up in green in the case of the geomagneticmode. The sensor value correction processing of the angular velocitysensor 123 and that of the magnetic sensor 121 may change places in anorder.

[Orientation Estimation]

With reference to FIG. 8, the orientation estimation processing at StepS17 of FIG. 6 is described in detail.

FIG. 8 is a flowchart of the orientation estimation processing.

With base vectors of the x axis, the y axis, and the z axis of the localcoordinate system when viewed from the world coordinate system as e_(x),e_(y), and e_(z) to define a matrix T_(L→W) (e_(x)e_(y)e_(z)) having therespective base vectors arranged in columns the following relationalexpressions 1 and 2 holds between a point p=(xyz)^(T) in the localcoordinate system, and a point P=(XYZ)^(T) in the world coordinatesystem corresponding to the point p (operator T refers to a transposedmatrix):P=T _(L→W) p  Equation 1 andp=T _(L→W) ^(T) P  Equation 2.

As such, since T_(L→W) indicates the relation between the two coordinatesystems, the current drumstick orientation state can be represented byusing the relation between the two coordinate systems and the like. Asan orientation representing method, an angle of pitch, yaw, roll, or thelike may be used.

Meanwhile, from the value of the angular velocity sensor 123 read at acurrent time t, a ternary vector having the respective axis componentsin the local coordinate system can be obtained. By multiplying the valueof each axis component of the ternary vector by δT, which is a samplingtime of the angular velocity sensor 123, a rotation angle vectorθt=(θ_(xt)θ_(yt)θ_(zt))^(T) can be found.

With this rotation angle vector, the orientation of the drumstick can befound. Specifically, by using a resultant matrix R_(all)(θ_(t)) ofrotation of θ_(xt) about the x axis, rotation of θ_(yt) about the yaxis, and rotation of θ_(zt) about the z axis and a previous orientationT_(L→Wt-1), an orientation T_(L→Wt) can be estimated asT_(L→Wt)=R_(all)(θ_(t))T_(L→Wt-1). As such, the CPU 11 updates theprevious orientation to estimate the current orientation based on thecurrent values of the angular velocity sensor 123 (Step S101).

However, in the orientation found as described above, errors accumulate.Also, once the orientation has an error, accuracy of orientationestimation thereafter is significantly degraded. For example, considerthat the drumstick section 10 is rotated from a forward horizon straighttoward a right horizon. First, if an error occurs in the rotation not ina horizontal direction but in a vertical direction, the drumstickrotates with the trajectory of the tip of the drumstick diagonallyrising upward. Then, a new rotation is added again to the orientation,and therefore the orientation becomes shifted at an accelerated ratefrom a proper orientation. Therefore, orientation estimation iscorrected by performing gravity estimation, and thereby increasesorientation accuracy.

An acceleration vector detected by the acceleration sensor 122 includescomponents of the respective axes in the local coordinate system. Thisacceleration vector is represented by a world coordinate system vectorby using orientation information found at Step S101.

If no external force is added, the acceleration sensor 122 only detectsgravity. Therefore, when the acceleration vector in the local coordinatesystem detected by the acceleration sensor 122 is converted to a vectorin the world coordinate system, the vector always indicates the samedirection. However, since an external force such as a centrifugal forceis added during the motion of the drumstick section 10, the vector isnot necessarily always oriented to the same direction. However, sincethe user swings the drumstick section 10 as being in a stationary state,the position of the drumstick section 10 does not move. Moreover, thevelocity becomes 0 in many cases such as the drumstick section 10 isswung upward or downward. That is, an integral of the external forceobtained by excluding a gravity component from the acceleration vectorbecomes 0 in many cases. Thus, the vector obtained by integrating theacceleration vector in the world coordinate system approximatelyindicates a gravity direction. By using this property, the gravitydirection of the world coordinate system is estimated.

Specifically, the acceleration value of each axis component obtained bythe acceleration sensor 122 read at the current time t is taken as_(L)A_(T)=(A_(xt)A_(yt)A_(zt))^(T), and since this acceleration value isin the local coordinate system, the CPU 11 carries out a calculation byconversion to the world coordinate system based on Equation 3 (StepS102):_(W) A _(T) =T _(L→Wt′L) A _(T)  Equation 3.

Next, for each component regarding the acceleration vector obtained byconversion to the world coordinate system, the CPU 11 calculates anaverage value from the current time to a predetermined time to find anaverage acceleration vector. The predetermined time is experimentallydetermined based on the swing state or the like. The CPU 11 estimatesthis average acceleration vector as a gravity direction vector_(W)e_(gt) (Step S103).

Specifically, the following Equation 4 is defined, and accumulation isperformed by recursive addition. K_(g) is a damping coefficient, and isexperimentally determined based on the swing state or the like:Gw _(t) =k _(g) ·Gw _(t-1)+_(w) A _(t)  Equation 4.

From Gw_(t), the gravity direction vector _(W)e_(gt) in the worldcoordinate system is estimated by _(W)e_(gt)=GW_(t)/|Gw_(t)|.

Next, the CPU 11 corrects the orientation parameter T_(L→Wt) so that thegravity direction vector _(W)e_(gt) becomes a negative direction vector(0 0 −1)^(T) on the z axis (Step S104). Specifically, the CPU 11performs operation for rotation about an axis orthogonal to these twovectors, that is, the gravity direction vector _(W)e_(gt) and thenegative direction vector (0 0 −1)^(T) by an angle formed therebetween,and thereby corrects the orientation parameter T_(L→Wt). With this, acorrection in the gravity direction is made, whereby accuracy oforientation estimation is improved.

Since the orientation is corrected as described above only in thegravity direction, error accumulations in a yaw angle centering on the Zaxis are left. The present embodiment suggests two methods to correctthe yaw angle, that is, a switch operation by the user and a correctionby using geomagnetism.

First, a correction by a switch operation by the user is described. Inthis correction, a correction is made by the CPU 11 to the yaw angle bythe user regularly pushing the input section 16 (for example, a switch)included in the drumstick section 10 at timing when the drumsticksection 10 is oriented upward. The CPU 11 judges whether a yaw directionforcible switch has been turned ON (Step S109). In this processing, theCPU 11 judges whether a signal has been received that indicates that theyaw direction forcible switch has been turned ON.

If the judgment result at Step S109 is YES, the CPU 11 finds a rotationmatrix that conforms a direction vector of the tip of the drumsticksection 10 in the world coordinate system to a Y-axis direction vectorin the world coordinate system and, by using this rotation matrix,corrects the orientation parameter (Step S110). With this, the yaw angleof the tip of the drumstick section 10 is set at 0 degree.

In this rotation matrix, consider a rotation angle vector having alength of an angle formed by two vectors and oriented to a vectordirection orthogonal to these two vectors. For this rotation anglevector, a conversion can be made to find a resultant matrix by using thesame method as that for finding a resultant rotation matrix for theorientation correction of the angular velocity sensor 123.

Next, correction using geomagnetism is described.

When the judgment result at Step S109 is NO, the CPU 11 judges whetherthe yaw direction correction mode is a correction mode in a geomagneticmode (Step S105). If the mode is not a correction mode in a geomagneticmode, the CPU 11 ends the orientation estimation processing.

If the mode is a correction mode in a geomagnetic mode, the CPU 11 takesthe value of the geomagnetic vector found from the magnetic sensor 121and read at the current time t as _(L)M_(T)=(M_(xt)M_(yt)M_(zt))^(T).Since this value is in the local coordinate system, the CPU 11 makes aconversion to the world coordinate system based on Equation 5 (StepS106):_(W) M _(T) =T _(L→Wt′L) M _(T)  Equation 5.

Next, for example, the CPU 11 performs smoothing by executing an IIR(Infinite Impulse Response) filter. A direction obtained by smoothing isestimated as a current geomagnetic direction _(W)e_(mt) (Step S107).

Specifically, the following IIR filter operation (Equation 6) isperformed for smoothing. k_(m) is a filter coefficient experimentallydetermined based on a swing state or the like.Mw _(t)=(1−k _(m))·Mw _(t-1) +k _(m)·_(W) A _(t)  Equation 6.

From Mw_(t), the geomagnetic direction vector _(W)e_(nt) in a worldcoordinate system is estimated by _(W)e_(mt)=Mw_(t)/|Mw_(t)|.

Subsequently, the CPU 11 records a geomagnetic direction _(W)e_(m0) inthe world coordinate system at an initial state in the RAM 15, finds arotation matrix so that the current geomagnetic direction _(W)e_(mt) andthe geomagnetic direction _(W)e_(m0) in the world coordinate system atthe initial state are oriented to the same direction on an XY plane inthe world coordinate system, and makes a correction of the orientationparameter T_(L→Wt) by using the rotation matrix (Step S108). With this,a correction in the geomagnetic direction is performed, and thereforeaccuracy of orientation estimation is improved.

Specifically, consider vectors with a Z component of each vector beingset at 0. Also, from these two vector directions, as with gravitycorrection, consider a vector oriented to a vector direction orthogonalto these two vectors and having a length at an angle formed by the twovectors. The rotation matrix described above can be represented withconversion to a resultant matrix of rotations of the values of therespective components of these vectors.

[Position Estimation]

With reference to FIG. 9, the position estimation processing at Step S18of FIG. 6 is described in detail.

FIG. 9 is a flowchart of the position estimation processing.

At orientation estimation, at Step S103 of FIG. 8, the gravity direction_(W)e_(gt) in the world coordinates is estimated. The CPU 11 finds avector by excluding a component in the gravity direction _(W)e_(gt) fromthe acceleration vector in the world coordinate system, and defines thefound vector as acceleration _(W)F_(T) by an external force (Step S201).Furthermore, the CPU 11 integrates the acceleration _(W)F_(T) by theexternal force to find a movement velocity _(W)V_(t), and furtherintegrates the movement velocity _(W)V_(t) to find a movement amount_(W)D_(t) on a horizontal plane (Step S202).

Since complete integral has an influence of error accumulation,incomplete integral is desirably used. A damping coefficient (a timeconstant) is adjusted by experiment. Thus found values are used insubsequent note event generation processing (refer to FIG. 16).

[Tip Motion Prediction]

With reference to FIG. 10 and FIG. 11, the tip motion predictionprocessing at Step S19 of FIG. 6 is described in detail.

The magnitude of sound emission is desirably controlled with thevelocity of the tip of the drumstick. In a velocity prediction method,the velocity is found from the acceleration sensor, but there is aproblem in accuracy. Moreover, since the user swings the drumstick witha rotating motion centering on the elbow or shoulder or as extending theelbow, only the angular velocity is not enough, and the angular velocityand the velocity may not have a proportional relation. For this reason,in the present embodiment, the velocity is predicted by using theangular velocity and angular acceleration of the tip.

FIG. 10 is a flowchart of the tip motion prediction processing.

As an example of calculating the angular velocity and angularacceleration, the CPU 11 first takes angular velocity obtained byexcluding components about the y axis from the angular velocity vectoras an observation value ωV_(t)=(ω_(xt)0 ω_(zt))^(T) of the angularvelocity of the tip of the drumstick, and uses a Kalman filter or thelike to estimate the value as angular velocity ωs and angularacceleration δωs (Step S210).

For example, each angular velocity component can be calculated by addingan angular velocity component to the previous angular velocitycomponent, and each angular acceleration component can be calculated byusing a state model in which drive noise is added to the same angularacceleration component as the previous one. By using the angularvelocity of the tip of the drumstick obtained as described above, theCPU 11 estimates the most recently averaged vector direction of theangular velocity as a drumstick tip velocity rotation axis e_(r) (StepS211).

While estimation is achieved by using the Kalman filter in the presentembodiment, an IIR filter may be used to smooth the values of therespective sensors and a difference therebetween to calculate angularvelocity and angular acceleration.

A direction orthogonal to the drumstick tip rotation axis and thedirection y axis of the drumstick (an outer product direction, refer toFIG. 11) is defined as a swing direction e_(s). A tangent direction of arotation motion of the tip is oriented to this swing direction. The CPU11 finds a component _(L)As_(t) in the swing direction of anacceleration vector _(L)A_(t) by calculating an inner product of_(L)A_(t) and e_(s).

[Sound Emission Timing Detection Processing]

With reference to FIG. 12 or FIG. 13, the sound emission timingdetection processing at Step S20 of FIG. 6 is described in detail.

[Sound Emission Timing Detection Processing (First Example)]

FIG. 12 is a flowchart of sound emission timing detection processing ina first example.

First, the processing of the CPU 11 branches off according to the motionstate (Step S302). There are four motion states: IDLE, ACTION, SHOT, andDONE. When the motion state is IDLE, the CPU 11 proceeds to Step S303.When the motion state is ACTION, the CPU 11 proceeds to Step S320. Whenthe motion state is SHOT, the CPU 11 proceeds to Step S330. When themotion state is DONE, the CPU 11 proceeds to Step S340.

Here, standard transitions of the motion state are depicted in FIG. 14Ato FIG. 14D. The horizontal axis represents a time axis in FIG. 14A toFIG. 14C, and the vertical axis represents the magnitude (the length ofthe vector) of the angular velocity in FIG. 14A. Although the sign arenot much meaningful, for the purpose of convenience, a direction inwhich the drumstick section 10 is started to be swung is assumed to bepositive. Also, in FIG. 14B, the vertical axis represents the magnitude(the length of the vector) of the angular acceleration. The signoriented to the same direction as the positive direction of the angularvelocity is assumed to be positive. FIG. 14C depicts acceleration in therotating direction. FIG. 14D depicts transitions of the motion state.

IDLE represents a state in which the drumstick is stationary, and themotion state in an initial state has been initialized to IDLE. At a timet0 in the initial state, the motion state is IDLE. Here, the CPU 11 endsthe sound emission timing detection processing when the angularacceleration of the drumstick section 10 is not positive (Step S303).Even if the angular acceleration of the drumstick section 10 ispositive, when the angular velocity of the drumstick section 10 is equalto or smaller than “Threshold 1”, the CPU 11 ends the sound emissiontiming detection processing (Step S304). When the angular velocity ofthe drumstick section 10 exceeds “Threshold 1”, the CPU 11 proceeds toStep S305 (Step S304). FIG. 14A depicts that the angular velocityexceeds “Threshold 1” at a time t2. At Step S305, the CPU 11 changes themotion state to ACTION (Step S305), initializes a maximum angularvelocity to 0 (Step S306), and ends the sound emission timing detectionprocessing.

When the motion state becomes ACTION, the drumstick continuesaccelerating for the time being, during which the angular accelerationis positive. Therefore, the judgment result at Step S320 is YES, and theCPU 11 compares the current angular velocity with the retained maximumangular velocity (Step S321). When the angular velocity is larger thanthe maximum angular velocity, the CPU 11 updates the maximum angularvelocity (Step S322) to update “Threshold 2” (Step S323). If the angularvelocity is smaller than the maximum angular velocity, the CPU 11 endsthe sound emission timing detection processing.

“Threshold 2” is determined based on the value of the maximum angularvelocity. For example, “Threshold 2” is found as “Threshold 2”=(MaximumAngular Velocity)×C, where C is experimentally determined from a valueof 0 to 1, and desirably on the order of 0.1 in a normal case. In“Threshold 2”, a previous angular velocity corresponding to a delay timefrom the time when a shot is detected to the time when a sound isemitted is assumed. This is because, due to the occurrence of a delay inwireless transmission or a delay in sound emission processing, whichwill be described further below, in order to compensate for the delay, asound is emitted before timing at which a sound is supposed to beemitted. In general, it is assumed that the curve of the angularvelocity of the shot is proportional to the intensity of a sound, andthe threshold is determined based on the maximum value of the angularvelocity.

When the drumstick section 10 is changed to be in a deceleration state(t3), the angular acceleration of the drumstick section 10 becomes 0 orsmaller, and therefore the judgment result at Step S320 is NO. At StepS324, the CPU 11 compares an absolute value of the current angularvelocity with “Threshold 2” to see whether the absolute value is smallerthan “Threshold 2”. While the drumstick is not being sufficientlydecelerated, the judgment result at Step S324 is NO, and the CPU 11 endsthe sound emission timing detection processing and wait for a shottiming.

If the drumstick has been decelerated sufficiently and the absolutevalue of the current angular velocity becomes smaller than “Threshold2”, the CPU 11 determines that shot timing is coming near, judges thatthe judgment result at Step S324 is YES (at a timing of t4), sets themotion state to SHOT (Step S325), and then initializes a shot passagetime to 0 (Step S326). Then, the CPU 11 ends the sound emission timingdetection processing. This SHOT state is to make a notification of soundemission timing, and is used to determine sound emission timing at StepS22 of FIG. 6.

When the motion state is SHOT, the CPU 11 updates the motion state toDONE at Step S330, and then ends the sound emission timing detectionprocessing.

When the motion state is DONE, the CPU 11 judges whether the angularvelocity is equal to or smaller than “Threshold 3” (Step S340). Whenjudged that the angular velocity is equal to or smaller than “Threshold3”, the CPU 11 changes the motion state to IDLE (Step S341) and ends thesound emission timing detection processing. When judged that the angularvelocity is larger than “Threshold 3” at Step S340, the CPU 11 judgeswhether the shot passage time is equal to or smaller than “Threshold 4”(Step S342). When judged that the shot passage time is equal to orsmaller than “Threshold 4”, the CPU 11 ends the sound emission timingdetection processing. On the other hand, when judged that the shotpassage time has exceeded “Threshold 4”, the CPU 11 changes the motionstate to IDLE (Step S341), and ends the sound emission timing detectionprocessing.

That is, the DONE state is held until the angular velocity becomes equalto or smaller than “Threshold 3”. This is to prevent an erroneousoperation such as emission of a plurality of sounds at the time ofstopping. However, if the angular velocity is gradually decelerated andthe shot passage time until the angular velocity becomes equal to orsmaller than “Threshold 3” exceeds “Threshold 4”, the motion state ischanged from DONE to IDLE.

[Sound Emission Timing Detection Processing (Second Example)]

FIG. 13 is a flowchart of sound emission timing detection processing ina second example.

First, the processing of the CPU 11 branches off according to the motionstate (Step S352). There are four motion states: IDLE, ACTION, SHOT, andDONE. When the motion state is IDLE, the CPU 11 proceeds to Step S353.When the motion state is ACTION, the CPU 11 proceeds to Step S370. Whenthe motion state is SHOT, the CPU 11 proceeds to Step S380. When themotion state is DONE, the CPU 11 proceeds to Step S390. Here, standardtransitions of the motion state are similar to those of the firstexample as depicted in FIG. 14A to FIG. 14D.

When the angular acceleration of the drumstick section 10 is notpositive, the CPU 11 ends the sound emission timing detection processing(Step S353). Even if the angular acceleration of the drumstick section10 is positive, when the angular velocity of the drumstick section 10 isequal to or smaller than “Threshold 1”, the CPU 11 ends the soundemission timing detection processing (Step S354). When the angularvelocity of the drumstick section 10 exceeds “Threshold 1”, the CPU 11proceeds to Step S355 (Step S354). In FIG. 14A, the angular velocityexceeds “Threshold 1” at the time t2. At Step S355, the CPU 11 changesthe motion state to ACTION (Step S355), and ends the sound emissiontiming detection processing.

When the motion state becomes ACTION, the drumstick continuesaccelerating for the time being, during which the angular accelerationis positive. Therefore, the CPU 11 judges that the judgment result atStep S370 is YES, and ends the sound emission timing detectionprocessing.

When the drumstick section 10 is changed to be in a deceleration state(t3), the angular acceleration of the drumstick section 10 becomes 0 orsmaller, and therefore the CPU 11 judges that the judgment result atStep S370 is NO. At Step S371, from a current drumstick tip angularvelocity ωs_(t) and an angular acceleration δωs_(t), the CPU 11estimates a time when the angular velocity becomes 0. If an estimatedtime is taken as Trem, the above-described time can be estimated byusing the following equation:Trem=|ωs _(t) |/|δωs _(t)|.

Subsequently, the CPU 11 judges whether the estimated time is equal toor smaller than “Threshold 5” (Step S372). For example, this “Threshold5” is assumed to be on the order of 10 milliseconds.

This “Threshold 5” is set as a delay time from the time when a shot isdetected to the time when a sound is emitted. This is because, due tothe occurrence of a delay in wireless transmission or a delay in soundemission processing which will be described further below, a sound isemitted before timing at which a sound is supposed to be emitted, inorder to compensate for the delay. Until the drumstick section 10sufficiently decelerates, the CPU 11 judges that the judgment result atStep S372 is NO and ends the sound emission timing detection processing.After a while, when the angular velocity of the drumstick section 10becomes near 0, the estimated time until the end (the angular velocityis 0) becomes equal to or smaller than “Threshold 5”. Then, the CPU 11judges that the judgment result at Step S372 is YES (at the timing oft4), sets the motion state to SHOT (Step S373), and initializes the SHOTpassage time to 0 (Step S374). This SHOT state is to make a notificationof sound emission timing, and is used to determine sound emission timingat Step S22 of FIG. 6.

When the motion state is SHOT, the CPU 11 updates the motion state toDONE at Step S380, and then ends the sound emission timing detectionprocessing.

When the motion state is DONE, the CPU 11 judges whether the angularvelocity is equal to or smaller than “Threshold 3” (Step S390). Whenjudged that the angular velocity is equal to or smaller than “Threshold3”, the CPU 11 changes the motion state to IDLE (Step S391) and ends thesound emission timing detection processing. When judged at Step S390that the angular velocity is larger than “Threshold 3”, the CPU 11determines whether the shot passage time is equal to or smaller than“Threshold 4” (Step S392). When judged that the shot passage time isequal to or smaller than “Threshold 4”, the CPU 11 ends the soundemission timing detection processing. On the other hand, when judgedthat the shot passage time has exceeded “Threshold 4”, the CPU 11changes the motion state to IDLE (Step S391), and ends the soundemission timing detection processing.

That is, the DONE state is held until the angular velocity becomes equalto or smaller than “Threshold 3”. This is to prevent an erroneousoperation such as emission of a plurality of sounds at the time ofstopping. However, if the angular velocity is gradually decelerated andthe shot passage time until the angular velocity becomes equal to orsmaller than “Threshold 3” exceeds “Threshold 4”, the motion state ischanged from DONE to IDLE.

[Sound Emission Amount Detection]

With reference to FIG. 15, the sound emission amount detectionprocessing at Step S21 of FIG. 6 is described in detail.

FIG. 15 is a flowchart of the sound emission amount detectionprocessing.

First, the CPU 11 determines the motion state. When the motion state isDONE or IDLE, the CPU 11 proceeds to Step S402. When the motion state isACTION or SHOT, the CPU 11 proceeds to Step S406.

When the motion state is DONE or IDLE, the CPU 11 initializes a peakangular velocity value (a scalar quantity) ω_(s peak), a shift velocityvs_(t), a peak shift velocity vs_(peak), and a peak shift accelerationas_(peak) to 0 (Steps S402 to S405).

The peak angular velocity value ω_(s peak) is a maximum value of theangular velocity detected while the drumstick is being swung for soundemission. The shift velocity vs_(t) is a velocity component oftranslation of the tip of the drumstick. The current peak shift velocityvs_(peak) is a value retaining a maximum value of a shift velocity_(L)Vs_(t). When the swing of the drumstick is detected in soundemission timing detection (Step S305 of FIG. 12) and the motion statebecomes ACTION or SHOT, the CPU 11 compares a scalar quantity |ω_(st)|of the current angular velocity of the tip of the drumstick and the peakangular velocity value ω_(s peak) and, when |ω_(st)| is larger, the CPU11 updates ω_(s peak) to |ω_(st)| (Step S406).

Next, the CPU 11 retains and updates the peak value as_(peak) of theshift acceleration of the acceleration component _(L)As_(t) in the swingdirection found at Step S212 of FIG. 10 (Step S407).

Subsequently, the CPU 11 finds an incomplete integral of theacceleration component _(L)As_(t) in the swing direction found at StepS212 of FIG. 10 to obtain the velocity _(L)Vs_(t) in the swing direction(Step S408).

Next, the CPU 11 compares the velocity _(L)Vs_(t) in the swing directionand the peak angular velocity value vs_(peak) and, when _(L)Vs_(t) islarger, the CPU 11 updates vs_(peak) to _(L)Vs_(t) (Step S409).

Next, the CPU 11 finds the velocity (sound volume) of the drumstick fromthree peak values by using, for example, a weighted addition as in thefollowing Equation 5:P _(shot) =a ₁·ω_(a peak) +a ₂ ·vs _(peak) +a ₃ ·as _(peak)  Equation 5where a₁, a₂, and a₃ are mixing parameters and are determined byexperiments.

P_(shot) is used as a magnitude of a shot sound.

[Note Event Generation]

With reference to FIG. 16, the note event generation processing at StepS23 of FIG. 6 is described in detail.

FIG. 16 is a flowchart of the note event generation processing.

At the time of a shot, it is determined which sound of sound sourcesvirtually arranged in a space is emitted. Since the shot timing isdetected in advance in consideration of the delay in the system, the CPU11 estimates the position of the drumstick section 10 when a sound isemitted (Step S501). Since the angular velocity and the angularacceleration of the tip of the drumstick section 10 are known, the CPU11 can estimate the position by finding the orientation of the drumstickafter Trem. Specifically, the CPU 11 further fragments Trem in time,takes a time interval therebetween as T, and finds an angular velocityat each time from the previous angular velocity vector and angularacceleration vector. Furthermore, with this angular velocity vector, theCPU 11 finds a rotation angle vector at each time interval, finds aresultant rotation matrix by using this rotation angle vector, andthereby predicts the next orientation. By repeating this to Trem, theorientation after Trem seconds can be predicted as T_(L→Wt+Trem). Fromthe orientation parameter, it is possible to obtain a positionP_(y)=(P_(yX)P_(yY)P_(yZ))^(T) in the world coordinate system on the yaxis in a direction of the tip of the drumstick section 10.

When six sound sources are mapped (placed) in the world coordinatesystem, the positions of the respective sound sources (the worldcoordinate system) are set as follows:

Sound Source 1: forward of (0, 1, 0)

Sound Source 2: in a direction at 60 degrees right forward of (sin 60,cos 60, 0)

Sound Source 3: in a direction at 60 degrees left forward of (−sin 60,cos 60, 0)

Sound Source 4: in a direction at 45 degrees up forward of (0, cos 45,sin 45)

Sound Source 5: in a direction at 60 degrees right forward and at 45degrees upward of (cos 45 sin 60, cos 45 cos 60, sin 45)

Sound Source 6: in a direction at 60 degrees left forward and at 45degrees upward of (−cos 45 sin 60, cos 45 cos 60, sin 45).

Positional information of the respective sound sources and timbrescorresponding to the respective sound source numbers are stored inadvance in the memory of the ROM 14.

The CPU 11 finds a distance between the position P_(y) of the drumsticksection 10 at sound emission estimated at Step S501 and the respectivesound source positions P_(si)=(P_(aiX)P_(aiY)P_(aiZ))^(T), and takes thenearest one as a sound source of a current shot target (Step S502).

In distance measurement, the CPU 11 calculates an Euclid distance.Alternatively, it is also effective to use a weighted Euclid distancefor each component that is insensitive to a distance in a swingdirection axis. Since the swing direction has low accuracy because theswing direction is a moving direction, it is desirable to use a distanceweighted larger than the rotation axis direction.

Alternatively, the azimuth can be converted to be represented in pitch,yaw, roll angles. The positions of the sound sources and the position ofthe drumstick may be converted to be represented in angle representationto find each distance. Here, a distance with a weight varied between apitch direction and a yaw direction may be used. The weight in a rollcomponent is desirably 0.

When the sound source number taken as a shot target at Step S502 or thesound source number determined in sound search processing, which will bedescribed further below with reference to FIG. 17, is taken as i, theCPU 11 reads a note corresponding to an i-th sound source (Step S503),thereby obtaining a note for sound emission.

Next, the CPU 11 checks the yaw direction correction mode determined atStep S79 or S80 of FIG. 7 (Step S504). When the yaw direction correctionmode is the geomagnetic mode, the CPU 11 ends the note even generationprocessing. On the other hand, when the yaw direction correction mode isthe shot mode, the CPU 11 finds a yaw angle error formed by the soundsource and the drumstick section 10 (Step S505). Specifically, the CPU11 finds a direction vector of the drumstick from the orientationparameter and a direction vector of the sound source by using theposition information of the sound source in the world coordinate systemdescribed above, and finds a difference of an angle of a vector formedof XY components of these two vectors as a yaw angle error. Since thisyaw angle error is an error of rotation about the Z axis, the CPU 11finds a rotation matrix with the Z axis as a rotation axis, and makes anorientation correction by using this rotation matrix (Step S506).

[Sound Search]

With reference to FIG. 17, sound search processing, which is amodification example of Step S502 of FIG. 16, is described in detail.

FIG. 17 is a flowchart of the sound search processing in themodification example of Step S502 of FIG. 16. This processing isperformed in place of the processing at Step S502 of FIG. 16. That is,this processing is performed after the processing at Step S501 of FIG.15 and, when Step S613 of the processing ends, the CPU 11 proceeds toStep S503 of FIG. 16.

First, the CPU 11 searches each sound map for the nearest sound sourceby using a sound search method similar to that at Step S502 of FIG. 16(Step S601).

Next, the CPU 11 stores the found sound source number i in the RAM 15 asa current sound source selection number (Step S602). Subsequently, theCPU 11 reads the previous sound source number, and compares positioncoordinates of the sound source number with position coordinates of thecurrent sound source. Here, the comparison is made in X and Ycoordinates, excluding the Z axis in the vertical direction (Step S603).The vertical direction is not corrected in the present example.

Furthermore, the CPU 11 judges whether the sound sources are in the sameazimuth (Step S604). When judged that they are in the same azimuth, theCPU 11 judges whether the horizontal component value of the movementamount found at S202 of FIG. 9 exceeds a predetermined positivethreshold (Step S605). When the judgment result is YES, the CPU 11causes the position P_(y) in the direction of the tip of the drumsticksection 10 to rotate in a positive direction by a predetermined rotationangle in the horizontal direction (Step S606). When the judgment resultat Step S605 is NO, the CPU 11 compares a negative threshold obtained bymultiplying the threshold by −1 and the horizontal component of themovement amount to judge whether the horizontal component is smallerthan the negative threshold (Step S607). When the judgment result isYES, the CPU 11 causes the position P_(y) in the direction of the tip ofthe drumstick section 10 to rotate in a negative direction by thepredetermined rotation angle in the horizontal direction (Step S608).

The CPU 11 corrects the azimuth in the direction of the tip of thedrumstick in the manner as described above to again find the nearestsound source from each sound map by using a sound search method similarto that at S502 of FIG. 16 (Step S609). The CPU 11 then judges whether asound source has been found (Step S610). If a sound source has beenfound (when the judgment result at Step S610 is YES), the CPU 11 updatesthe newly found sound source with the current sound source number, andstores the sound source number in the RAM 15 (Step S611). If a soundsource has not been found (when the judgment result at Step S610 is NO),the previous sound source number is retained.

Next, to find a movement amount between the next shot and the currentshot, the CPU 11 resets the movement amount value to 0 (Step S612).Furthermore, the CPU 11 stores the currently adopted sound source numberin the RAM 15 as the previous sound source number (Step S613).

[Sound Emission Processing]

With reference to FIG. 18, sound emission processing to be performed bythe sound emitting section 30 is described.

FIG. 18 is a flowchart of sound emission processing to be performed bythe sound emitting section 30.

As depicted in FIG. 18, the CPU 31 of the sound emitting section 30performs initialization processing including clearing the data in theRAM 34, clearing an image displayed on the screen of the display section35, the sound source section 371, and the like, at power-up (Step S701).Next, the CPU 31 performs switch processing (Step S702). In the switchprocessing, for example, the CPU 31 specifies a sound volume value and atimbre desired by the instrument player according to a switch operationof the input section 36, and stores the specified value and timbre inthe RAM 34.

Subsequently, the CPU 31 judges whether the I/F 32 has newly received anote-on event (Step S703). When the judgment result at Step S703 is YES,the CPU 31 performs processing for instructing the sound source section371 to emit a musical sound with the set sound volume value and timbrebased on the received note-on event (Step S704). When the processing atStep S704 ends, the CPU 31 returns to Step S702.

The structure and processing of the musical performance device 1 of thepresent embodiment have been described above.

In the present embodiment, the CPU 11 obtains the acceleration detectedby the acceleration sensor 122 and the angular velocity detected by theangular velocity sensor 123 at every predetermined timing, and stores,in the RAM 15, an orientation parameter in an initial stationary stateof the drumstick section 10, which includes the acceleration by gravitydetected by the acceleration sensor 122 in the initial stationary state.Then, the CPU 11 updates the orientation parameter according to theangular velocity detected by the angular velocity sensor 123 at everypredetermined timing, and calculates acceleration in a gravity directionfrom the detected acceleration based on the updated orientationparameter. Furthermore, the CPU 11 accumulates the calculatedacceleration for each predetermined interval, and corrects theacceleration obtained by accumulation so that the acceleration conformsto the acceleration stored in the RAM 15.

Thus, when the drumstick section 10 is moved at high speed, accuracy inestimating the orientation of the drumstick section 10 can be improvedby correcting the gravity direction.

Also in the present embodiment, in the initial stationary state of thedrumstick section 10, the CPU 11 causes the magnetic sensor 121 todetect a geomagnetic component in each of directions of three axesorthogonal to each other including an axis in a longitudinal directionof the drumstick section 10, converts the detected geomagneticcomponents to geomagnetic components in directions of other three axesbased on the orientation parameter described above, and stores thecomponents obtained by conversion in the RAM 15. Then, the CPU 11obtains the geomagnetic components of the respective axes detected bythe magnetic sensor 121 at every predetermined timing and, based on theorientation parameter, converts the geomagnetic components of therespective axes obtained at every predetermined timing to geomagneticcomponents in the directions of different three axes described above.Furthermore, the CPU 11 accumulates the geomagnetic components obtainedby conversion for each predetermined interval, and corrects eachgeomagnetic component obtained by accumulation so that the geomagneticcomponent conforms to the geomagnetic component stored in the RAM 15.

Thus, when the drumstick section 10 is moved at high speed, accuracy inestimating the orientation of the drumstick section 10 can be improvedby correcting the geomagnetic direction.

Furthermore, in the present embodiment, after the angular velocity valueobtained by the angular velocity sensor 123 exceeds “Threshold 1” andthen becomes below “Threshold 2”, the CPU 11 transmits a note-on eventto the sound emitting section 30. “Threshold 2” is a value according tothe maximum value after the angular velocity value obtained by theangular velocity sensor 123 exceeds “Threshold 1” (specifically, a valueobtained by multiplying the maximum value by a predetermined ratiovalue).

Thus, accuracy in sound emission can be improved by generating soundemission timing at a predetermined time ahead of the original shottiming, in consideration of a sound emission delay time.

Still further, in the present embodiment, the CPU 11 estimates a timeuntil the angular velocity becomes 0 after the value of the angularvelocity obtained by the angular velocity sensor 123 exceeds “Threshold1” and, when the estimated time becomes below “Threshold 5”, transmits anote-on even to the sound emitting section 30.

Thus, accuracy in sound emission can be improved by generating soundemission timing at a predetermined time ahead of the original shottiming, in consideration of a sound emission delay time.

Yet still further, in the present embodiment, the CPU 11 calculates theangular velocity and the angular acceleration of the tip of thedrumstick section 10 based on the angular velocity obtained by theangular velocity sensor 123, and estimates a time until the value of theangular velocity becomes 0 after the value of the angular velocityobtained by the angular velocity sensor 123 exceeds “Threshold 1”, basedon the calculated angular velocity and angular acceleration of the tipof the drumstick section 10.

Thus, accuracy in estimating the time until the angular velocity valuebecomes 0 can be improved.

Yet still further, in the present embodiment, the CPU 11 estimates therotation axis direction of the drumstick section 10 during musicalperformance based on the angular velocity obtained by the angularvelocity sensor 123, calculates the angular velocity of the tip of thedrumstick section 10 based on the angular velocity obtained by excludingan axis component in the longitudinal direction of the drumstick section10 from the angular velocity obtained by the angular velocity sensor123, and calculates the position of the drumstick section 10 in theworld coordinate system after a predetermined time based on theestimated latest rotation axis direction and the calculated latestangular velocity of the tip of the drumstick section 10. Of theplurality of areas of the sound source map, the CPU 11 transmits anote-on event of a musical sound corresponding to the area nearest tothe calculated position to the sound emitting section 30.

Thus, even if the drumstick section 10 is diagonally swung, the timbreat the position of the drumstick section 10 can be emitted at theoriginal shot timing.

Still further, in the present embodiment, the CPU 11 estimates therotation axis direction of the drumstick section 10 during musicalperformance based on the angular velocity obtained by the angularvelocity sensor 123, and calculates the angular velocity of the tip ofthe drumstick section 10 based on angular velocity obtained by excludingan axial component in a longitudinal direction of the drumstick section10 from the angular velocity obtained by the angular velocity sensor123. Based on the estimated latest rotation axis direction and thecalculated latest angular velocity of the tip of the drumstick section10, the CPU 11 calculates the position of the drumstick section 10 inthe world coordinate system after a predetermined time, calculates amovement distance based on the acceleration obtained by the accelerationsensor 122, and corrects the position of the drumstick section 10 in theworld coordinate system after a predetermined time based on thecalculated position and the calculated movement distance. Then, of theplurality of areas of the sound source map, the CPU 11 transmits anote-on event of a musical sound corresponding to the area nearest tothe corrected position to the sound emitting section 30.

Thus, even if the drumstick section 10 is diagonally swung and issubjected to translation, a sound can be emitted with a timbre at theposition of the drumstick section 10 at the original shot timing.

Yet still further, in the present embodiment, the CPU 11 calculates amaximum value of the angular velocity of the drumstick section 10 duringmusical performance based on the angular velocity obtained by theangular velocity sensor 123, calculates a maximum of acceleration of thedrumstick section 10 during musical performance based on theacceleration obtained by the acceleration sensor 122, and control thesound volume of the musical sound to be emitted based on the calculatedmaximum value of the angular velocity and the maximum value of theacceleration.

Thus, even if a virtual sound source is placed vertically to the worldcoordinate system, appropriate sound volume control can be performed byreflecting the strength of the swing motion.

While the present invention has been described with reference to thepreferred embodiments, it is intended that the invention be not limitedby any of the details of the description therein but includes all theembodiments which fall within the scope of the appended claims.

What is claimed is:
 1. An orientation detection device control methodperformed by an orientation detection device that can be held by a user,the orientation detection device comprising a housing member to be heldby the user, a triaxial magnetic sensor housed in the housing member,and an angular velocity sensor housed in the housing member, the methodcomprising: storing, in a memory, an orientation parameter of theorientation detection device, wherein the orientation parameter isindicated by pitch, yaw, and roll in a coordinate system based on adirection of geomagnetism; successively detecting vectors of angularvelocity by the angular velocity sensor provided in the orientationdetection device; successively updating the orientation parameter storedin the memory according to the vectors of angular velocity successivelydetected by the angular velocity sensor, wherein the updating isperformed a plurality of times without correcting the direction ofgeomagnetism; successively detecting a vector of magnetism occurring ineach direction of three axes of the orientation detection device whichare orthogonal to each other by the triaxial magnetic sensor provided inthe orientation detection device; obtaining the direction ofgeomagnetism by accumulating a plurality of vectors of magnetismsuccessively detected by the triaxial magnetic sensor; successivelycorrecting the updated orientation parameter stored in the memory bycorrecting the direction of geomagnetism of the coordinate systemaccording to the direction of geomagnetism obtained, wherein thecorrecting is performed by correcting a shift of the direction ofgeomagnetism that is successively accumulated by the updating;determining a position of the orientation detection device in thecoordinate system, based on the orientation parameters that aresuccessively corrected; and controlling, based on the determinedposition of the orientation detection device in the coordinate system,at least one of (i) a timing at which information that is perceivable bythe user holding the orientation detection device is output, and (ii)selection of a type of the information which is output and isperceivable by the user, wherein selection of the type of theinformation which is output is performed by comparing the determinedposition of the orientation detection device in the coordinate systemwith a plurality of predetermined positions in the coordinate systemwhich are stored in advance in the memory, and selecting the type of theinformation which is output based on a result of the comparison.
 2. Theorientation detection device control method according to claim 1,further comprising: successively correcting the updated orientationparameter stored in the memory by successively correcting the directionof geomagnetism of the coordinate system according to the direction ofgeomagnetism successively obtained by the triaxial magnetic sensor. 3.The orientation detection device control method according to claim 1,wherein the coordinate system is based on a direction of gravity; andwherein the method further comprises: obtaining a direction of gravityby accumulating a plurality of vectors successively detected by anacceleration sensor provided in the device; and successively correctingthe updated orientation parameter by correcting the direction of gravityof the coordinate system according to a direction of gravity obtainedusing the acceleration sensor.
 4. An orientation detection devicecomprising: the housing member; the angular velocity sensor; thetriaxial magnetic sensor; and a processor which executes the orientationdetection device control method according to claim
 1. 5. The orientationdetection device control method according to claim 1, furthercomprising: judging whether or not the device is in a stationary stateon condition that there is no change in vectors of acceleration detectedby an acceleration sensor provided in the orientation detection device;initializing the orientation parameter at a timing at which it is judgedthat the device is in the stationary state, wherein the initializingincludes initializing the direction of geomagnetism in the coordinatesystem; and successively correcting the updated orientation parameter,wherein the correcting includes correcting the direction of geomagnetismin the coordinate system, and wherein the correcting is successivelyperformed at a timing at which it is not judged whether or not thedevice is in the stationary state.
 6. The orientation detection devicecontrol method according to claim 1, wherein emission of a musical soundis controlled based on the orientation parameter.
 7. The orientationdetection device control method according to claim 6, wherein a positionof the orientation detection device is specified based on vectors ofacceleration obtained by an acceleration sensor provided in the device,and content of the musical sound to be emitted is controlled based onthe specified position of the device.
 8. The orientation detectiondevice control method according to claim 6, wherein a movement velocityof a portion of the device is specified based on the vectors of angularvelocity obtained by the angular velocity sensor, and a timing ofemitting the musical sound is controlled based on the specified movementvelocity.
 9. The orientation detection device control method accordingto claim 6, wherein a movement velocity of a portion of the orientationdetection device is specified based on the vectors of angular velocityobtained by the angular velocity sensor, and a sound volume of themusical sound to be emitted is controlled based on the specifiedmovement velocity.
 10. An orientation detection device comprising: thehousing member; the triaxial magnetic sensor; the angular velocitysensor; the memory; and a processor which is configured to control theorientation detection device to perform the orientation detection devicecontrol method according to claim
 1. 11. The orientation detectiondevice control method according to claim 1, wherein the information thatis perceivable by the user is a musical sound, and wherein an outputstate of the musical sound is controlled based on the orientationparameters that are successively corrected.
 12. The orientationdetection device control method according to claim 11, wherein theoutput state of the musical sound is a timbre and pitch of the musicalsound.
 13. The orientation detection device control method according toclaim 1, wherein a correspondence relationship between a respectiveplurality of different orientation parameters and respective pluralpieces of different output information is stored in advance, and a pieceof output information to be changed corresponding to the orientationparameters that are successively corrected is determined based on thecorrespondence relationship.
 14. The orientation detection devicecontrol method according to claim 12, wherein a correspondencerelationship between a respective plurality of different orientationparameters and a respective plurality of musical sounds is stored inadvance, and a musical sound to be changed is determined based on thecorrespondence relationship.